﻿using Microsoft.SharePoint;

namespace SPSource2010.Lists
{
    public class ListEnumHelpers
    {
        public static string ReturnDraftVersionVisibility(SPList list)
        {
            switch (list.DraftVersionVisibility)
            {
                case Microsoft.SharePoint.DraftVisibilityType.Author:
                    return "1";
                case Microsoft.SharePoint.DraftVisibilityType.Approver:
                    return "2";
                case Microsoft.SharePoint.DraftVisibilityType.Reader:
                    return "0";
                default:
                    return "0";
            }
        }

        public static string ReturnBaseType(SPList list)
        {
            switch (list.BaseType)
            {
                case Microsoft.SharePoint.SPBaseType.DocumentLibrary:
                    return "1";
                case Microsoft.SharePoint.SPBaseType.GenericList:
                    return "0";
                case Microsoft.SharePoint.SPBaseType.Issue:
                    return "5";
                case Microsoft.SharePoint.SPBaseType.Survey:
                    return "4";
                case Microsoft.SharePoint.SPBaseType.UnspecifiedBaseType:
                    return "6";
                case Microsoft.SharePoint.SPBaseType.DiscussionBoard:
                    return "3";
                case Microsoft.SharePoint.SPBaseType.Unused:
                    return "2";
                default:
                    return "0";
            }
        }

        public static string ReturnDefaultItemOpen(SPList list)
        {
            switch (list.DefaultItemOpen)
            {
                case Microsoft.SharePoint.DefaultItemOpen.PreferClient:
                    return "0";
                case Microsoft.SharePoint.DefaultItemOpen.Browser:
                    return "1";
                default:
                    return "0";
            }
        }
    }
}
